﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Data;
using Gem_Tools_Utility;

namespace Gem_Tools_Entity.Gem_Tools
{
    public class CAsset
    {
        private int m_intAuto_ID;
        private int m_intProject_ID;
        private int m_intGroup_ID;
        private string m_strName;
        private string m_strURL;
        private DateTime m_dtmStart_Date;
        private DateTime m_dtmEnd_Date;
        private double m_dbManday;
        private string m_strNote;
        private Boolean m_blIsAssign;
        private DateTime m_dtmCreated;
        private string m_strCreated_By;
        private int m_intDeleted;
        private DateTime m_dtmLast_Updated;
        private string m_strLast_Updated_By;
        //update thêm 1 trường đại diện cho start date và end date:
        private string m_strStar_Date;
        private string m_strEnd_Date;
        
        public CAsset()
        {
            ResetData();
        }

        public void ResetData()
        {
            m_intAuto_ID = CConst.INT_VALUE_NULL;
            m_intProject_ID = CConst.INT_VALUE_NULL;
            m_intGroup_ID = CConst.INT_VALUE_NULL;
            m_strName = CConst.STR_VALUE_NULL;
            m_strURL = CConst.STR_VALUE_NULL;
            m_dtmStart_Date = CConst.DTM_VALUE_NULL;
            m_dtmEnd_Date = CConst.DTM_VALUE_NULL;
            m_dbManday = CConst.DB_VALUE_NULL;
            m_strNote = CConst.STR_VALUE_NULL;
            m_blIsAssign = CConst.BL_VALUE_NULL;
            m_dtmCreated = CConst.DTM_VALUE_NULL;
            m_strCreated_By = CConst.STR_VALUE_NULL;
            m_intDeleted = CConst.INT_VALUE_NULL;
            m_dtmLast_Updated = CConst.DTM_VALUE_NULL;
            m_strLast_Updated_By = CConst.STR_VALUE_NULL;
            m_strStar_Date = CConst.STR_VALUE_NULL;
            m_strEnd_Date = CConst.STR_VALUE_NULL;
        }


        public int Auto_ID
        {
            get
            {
                return m_intAuto_ID;
            }
            set
            {
                m_intAuto_ID = value;
            }
        }


        public int Project_ID
        {
            get
            {
                return m_intProject_ID;
            }
            set
            {
                m_intProject_ID = value;
            }
        }


        public int Group_ID
        {
            get
            {
                return m_intGroup_ID;
            }
            set
            {
                m_intGroup_ID = value;
            }
        }


        public string Name
        {
            get
            {
                return m_strName;
            }
            set
            {
                m_strName = value.Trim();
            }
        }


        public string URL
        {
            get
            {
                return m_strURL;
            }
            set
            {
                m_strURL = value.Trim();
            }
        }


        public DateTime Start_Date
        {
            get
            {
                return m_dtmStart_Date;
            }
            set
            {
                m_dtmStart_Date = value;
            }
        }


        public DateTime End_Date
        {
            get
            {
                return m_dtmEnd_Date;
            }
            set
            {
                m_dtmEnd_Date = value;
            }
        }


        public double Manday
        {
            get
            {
                return m_dbManday;
            }
            set
            {
                m_dbManday = value;
            }
        }


        public string Manday_string
        {
            get
            {
                if (m_dbManday == CConst.DB_VALUE_NULL)
                {
                    return "";
                }
                return m_dbManday.ToString();
            }
        }


        public string Note
        {
            get
            {
                return m_strNote;
            }
            set
            {
                m_strNote = value.Trim();
            }
        }

        public Boolean is_Assign
        {
            get
            {
                return m_blIsAssign;
            }
            set
            {
                m_blIsAssign = value;
            }
        }


        public DateTime Created
        {
            get
            {
                return m_dtmCreated;
            }
            set
            {
                m_dtmCreated = value;
            }
        }


        public string Created_By
        {
            get
            {
                return m_strCreated_By;
            }
            set
            {
                m_strCreated_By = value.Trim();
            }
        }


        public int Deleted
        {
            get
            {
                return m_intDeleted;
            }
            set
            {
                m_intDeleted = value;
            }
        }


        public DateTime Last_Updated
        {
            get
            {
                return m_dtmLast_Updated;
            }
            set
            {
                m_dtmLast_Updated = value;
            }
        }


        public string Last_Updated_By
        {
            get
            {
                return m_strLast_Updated_By;
            }
            set
            {
                m_strLast_Updated_By = value.Trim();
            }
        }


        public string Start_Date_String
        {
            get
            {
                if (m_dtmStart_Date != CConst.DTM_VALUE_NULL)
                {
                    return m_dtmStart_Date.ToString("dd-MMM-yy");
                }

                return "";
            }
            set
            {
                m_strStar_Date = value.Trim();
            }
        }


        public string End_Date_String
        {
            get
            {
                if (Manday > 0)
                {
                    return m_dtmStart_Date.AddDays(Manday).ToString("dd-MMM-yy");
                }

                return "";
            }
        }
    }
}
